package com.hy.mvc.biz.excel.builder;


import com.hy.mvc.biz.excel.exportstrategy.CommonPropertyStrategy;
import com.hy.mvc.biz.excel.exportstrategy.ContentStrategy;
import com.hy.mvc.biz.excel.exportstrategy.HeadStrategy;
import com.hy.mvc.biz.excel.exportstrategy.TitleStrategy;
import com.hy.mvc.biz.excel.model.SimpleExcelModel;
import org.apache.poi.hssf.usermodel.HSSFSheet;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by Booker on 2017/7/3.
 */
public abstract class AbstractSheetBuilder {
    private SimpleExcelModel excelModel;

    @Resource
    private CommonPropertyStrategy commonPropertyStrategy;

    @Resource
    private TitleStrategy titleStrategy;

    @Resource
    private HeadStrategy headStrategy;

    @Resource
    private ContentStrategy contentStrategy;

    public HSSFSheet buildCommonProperty(HSSFSheet workSheet, SimpleExcelModel excelModel) {
        return commonPropertyStrategy.buildCommonProperty(workSheet, excelModel);
    }

    public HSSFSheet buildTitle(HSSFSheet workSheet, SimpleExcelModel excelModel) {
        return titleStrategy.buildTitle(workSheet, excelModel);
    }

    public HSSFSheet buildHeader(HSSFSheet workSheet, SimpleExcelModel excelModel) {
        return headStrategy.buildHeaders(workSheet, excelModel);
    }

    public HSSFSheet buildContent(HSSFSheet workSheet, SimpleExcelModel excelModel, List<?> exportList) {
        return contentStrategy.buildContent(workSheet, excelModel, exportList);
    }

    public abstract HSSFSheet buildSheet(HSSFSheet workSheet, List<?> exportList);

    public SimpleExcelModel getExcelModel() {
        return excelModel;
    }

    public void setExcelModel(SimpleExcelModel excelModel) {
        this.excelModel = excelModel;
    }

    public CommonPropertyStrategy getCommonPropertyStrategy() {
        return commonPropertyStrategy;
    }

    public void setCommonPropertyStrategy(CommonPropertyStrategy commonPropertyStrategy) {
        this.commonPropertyStrategy = commonPropertyStrategy;
    }

    public TitleStrategy getTitleStrategy() {
        return titleStrategy;
    }

    public void setTitleStrategy(TitleStrategy titleStrategy) {
        this.titleStrategy = titleStrategy;
    }

    public HeadStrategy getHeadStrategy() {
        return headStrategy;
    }

    public void setHeadStrategy(HeadStrategy headStrategy) {
        this.headStrategy = headStrategy;
    }

    public ContentStrategy getContentStrategy() {
        return contentStrategy;
    }

    public void setContentStrategy(ContentStrategy contentStrategy) {
        this.contentStrategy = contentStrategy;
    }
}
